Chapter 2 Exercise

1.
[[code format="python"]]a = 'All'b = 'work'
c = 'and'
d = 'no'
e = 'play'f = 'makes'g = 'Jack'h = 'a'i = 'dull'
j = 'boy'
print(a,b,c,d,e,f,g,h,i,j)
 
2.
6 * (1 - 2)
 
3.
#error
 
4.
bruce=6
print(bruce + 4)
 
5.
p=10000
n=12
r=0.08
t=int(input())
A=p*(1+r/n)**(n*t)
print(A)
 
6.
#It can not divided by 0
 
7.
#5 p.m.8.
initial_time=int(input('what time is it?'))
total_time=51
time_to_alarm=(initial_time+total_time)%24
print('time to alarm:' ,time_to_alarm)